package dome4;

class Message<T> {
    private T message ;
    public T getMessage() {
        return message;
    }
    public void setMessage(T message) {
        this.message = message;
    }
}
public class TestDemo {
    public static void main(String[] args) {
        Message<String> message = new Message<>();
        message.setMessage("hello");
        fun(message);

        Message<Integer> message2 = new Message<>();
        message2.setMessage(123);
        fun(message2);
    }

    public static void fun(Message<?> temp) {
//        temp.setMessage(123); error;
//        Object val = temp.getMessage(); true
        System.out.println(temp.getMessage());
    }
}
